package main.java.com.rmisorter;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;

public class SortServer {
	
	public SortServer() throws RemoteException, MalformedURLException {
		ISortFactory sortFactory = new SortFactory();
		rebindNaming(sortFactory);
	}
	
	private void rebindNaming(ISortFactory sortFactory) throws RemoteException {
		 java.rmi.registry.LocateRegistry.createRegistry(1099);
		try {
			Naming.rebind("rmi:///rmisorter", sortFactory);	
		}
		catch (MalformedURLException e) {
			System.out.println("Could not rebind naming");
		}
		
	}
	
	public static void main(String[] args) throws RemoteException, MalformedURLException {
		new SortServer();
	}

}
